<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('会员列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>会员ID：</label>
                                <input type="text" name="memberId"/>
                            </li>
                            <li>
                                <label>会员类型：</label>
                                <select name="memberType" th:with="type=${@dict.getType('erp_member_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>用户性别：</label>
                                <select name="memberSex" th:with="type=${@dict.getType('sys_user_sex')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>


                            <li>
                                <label>手机号：</label>
                                <input type="text" name="memberMobile"/>
                            </li>
                            <li>
                                <label>姓名：</label>
                                <input type="text" name="memberName"/>
                            </li>

                            <li>
                                <label>纬度：</label>
                                <input type="text" name="latitude"/>
                            </li>
                            <li>
                                <label>经度：</label>
                                <input type="text" name="longitude"/>
                            </li>
                            <li>
                                <label>会员状态：</label>
                                <select name="memberStatus" th:with="type=${@dict.getType('member_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>

                            <li>
                                <label>部门ID：</label>
                                <input type="text" name="deptId"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="erp:member:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="erp:member:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="erp:member:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="erp:member:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('erp:member:edit')}]];
        var removeFlag = [[${@permission.hasPermi('erp:member:remove')}]];
        var memberSexDatas = [[${@dict.getType('sys_user_sex')}]];
        var memberStatusDatas = [[${@dict.getType('member_status')}]];
        var memberTypeDatas = [[${@dict.getType('erp_member_type')}]];
        var prefix = ctx + "erp/member";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "会员",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'memberOpenId',
                    title: '用户openid',
                    visible: false
                },
                {
                    field: 'memberId',
                    title: '会员ID'
                },
                {
                    field: 'parentId',
                    title: '上级ID',
                    visible: false
                },
                {
                    field: 'createUserId',
                    title: '创建者ID',
                    visible: false
                },
                {
                    field: 'updateUserId',
                    title: '更新者ID',
                    visible: false
                },
                {
                    field: 'remark',
                    title: '备注',
                    visible: false
                },
                {
                    field: 'memberNickname',
                    title: '用户昵称'
                },
                {
                    field: 'memberSex',
                    title: '用户性别',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(memberSexDatas, value);
                    }
                },
                {
                    field: 'memberProvince',
                    title: '省份',
                    visible: false
                },
                {
                    field: 'memberDistrict',
                    title: '区域',
                    visible: false
                },
                {
                    field: 'memberCityId',
                    title: '城市编号',
                    visible: false
                },
                {
                    field: 'memberCity',
                    title: '城市',
                    visible: false
                },
                {
                    field: 'memberAge',
                    title: '年龄',
                    visible: false
                },
                {
                    field: 'memberCountry',
                    title: '国家',
                    visible: false
                },
                {
                    field: 'memberHeadImgUrl',
                    title: '头像' ,
                    formatter: function (value, row, index) {
                        return $.table.imageView(row.memberHeadImgUrl, 500, 500, "self");
                    }
                },
                {
                    field: 'memberMobile',
                    title: '手机号'
                },
                {
                    field: 'memberName',
                    title: '姓名'
                },
                {
                    field: 'memberAddress',
                    title: '详细地址',
                    visible: false
                },
                {
                    field: 'memberLastLoginTime',
                    title: '最后登录时间',
                    visible: false
                },
                {
                    field: 'latitude',
                    title: '纬度',
                    visible: false
                },
                {
                    field: 'longitude',
                    title: '经度',
                    visible: false
                },
                {
                    field: 'memberStatus',
                    title: '会员状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(memberStatusDatas, value);
                    }
                },
                {
                    field: 'memberType',
                    title: '会员类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(memberTypeDatas, value);
                    }
                },
                {
                    field: 'deptId',
                    title: '部门ID',
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.memberOpenId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.memberOpenId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>